package com.yld.ch01;

public class PrintUtil {
	
	
	
	
	public synchronized  void printTask(){
		String  name="huanglaoshi";
		
		for(int index=0; index<name.length();index++){
			
			System.out.print(name.charAt(index));
			
			//每打印一个字符 让线程 休息10毫秒
			
			try {
				
				//  洗手间  sleep是不释放锁
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		System.out.println();
	}
	

}
